home *** CD-ROM | disk | FTP | other *** search
/ Whiteline: Transmission / whiteline CD Series - Transmission.iso / utilitys / packer / atomik33 / depack.s < prev    next >
Encoding:
Text File  |  1995-06-07  |  4.0 KB  |  197 lines

  1. ;decrunch source code of ATOMIK by ALTAIR    ;je tiens a preciser
  2. ;A0=packed code        ;que j'ai entierement
  3. ;call it by bsr        ;ecris ce compacteur
  4.             ;environnement compris.
  5. DEC_MARGE:    equ    $10    ;min=0 , max=126 (pair!)
  6. RESTORE_M:    equ    1    ;argh j'ai planté pendant
  7.             ;10 jours sur TOTAL RECALL
  8.             ;a cause de ca!!!!!
  9. PIC_ALGO:    equ    1    ;PIC_ALGO=1,RESTORE_M=0 ; lenght=$18e
  10. depack:    movem.l    d0-a6,-(a7)    ;PIC_ALGO=0,RESTORE_M=0 ; lenght=$146
  11.     cmp.l    #"ATOM",(a0)+    ;RESTORE_M=1 ; lenght=lenght+
  12.     bne    no_crunched    ;DEC_MARGE+$32
  13.     move.l    (a0)+,d0
  14.     move.l    d0,-(a7)
  15.     lea    DEC_MARGE(a0,d0.l),a5
  16.     ifne    RESTORE_M
  17.     move.l    a5,a4
  18.     lea    buff_marg(pc),a3
  19.     moveq    #DEC_MARGE+9,d0
  20. .save_m:    move.b    -(a4),(a3)+
  21.     dbf    d0,.save_m
  22.     movem.l    a3-a4,-(a7)
  23.     endc
  24.     ifne    PIC_ALGO
  25.     pea    (a5)
  26.     endc
  27.     move.l    (a0)+,d0    
  28.     lea    0(a0,d0.l),a6
  29.     move.b    -(a6),d7
  30.     bra    make_jnk
  31. tablus:    lea    tablus_table(pc),a4
  32.     moveq    #1,d6
  33.     bsr.s    get_bit2
  34.     bra.s    tablus2
  35. decrunch:    moveq    #6,d6
  36. take_lenght:    add.b    d7,d7
  37.     beq.s    .empty1
  38. .cont_copy:    dbcc    d6,take_lenght
  39.     bcs.s    .next_cod
  40.     moveq    #6,d5
  41.     sub    d6,d5
  42.     bra.s    .do_copy
  43. .next_cod:    moveq    #3,d6
  44.     bsr.s    get_bit2
  45.     beq.s    .next_cod1
  46.     addq    #6,d5
  47.     bra.s    .do_copy
  48. .next_cod1:    moveq    #7,d6
  49.     bsr.s    get_bit2
  50.     beq.s    .next_cod2
  51.     add    #15+6,d5
  52.     bra.s    .do_copy
  53. .empty1:    move.b    -(a6),d7
  54.     addx.b    d7,d7
  55.     bra.s    .cont_copy
  56. .next_cod2:    moveq    #13,d6
  57.     bsr.s    get_bit2
  58.     add    #255+15+6,d5
  59. .do_copy:    move    d5,-(a7)
  60.     bne.s    bigger
  61.     lea    decrun_table2(pc),a4
  62.     moveq    #2,d6
  63.     bsr.s    get_bit2
  64.     cmp    #5,d5
  65.     blt.s    contus
  66.     addq    #2,a7
  67.     subq    #6,d5
  68.     bgt.s    tablus
  69.     move.l    a5,a4
  70.     blt.s    .first4
  71.     addq    #4,a4
  72. .first4:    moveq    #1,d6
  73.     bsr.s    get_bit2
  74. tablus2:    move.b    0(a4,d5.w),-(a5)    
  75.     bra.s    make_jnk
  76. get_bit2:    clr    d5
  77. .get_bits:    add.b    d7,d7
  78.     beq.s    .empty
  79. .cont:    addx    d5,d5
  80.     dbf    d6,.get_bits
  81.     tst    d5
  82.     rts
  83. .empty:    move.b    -(a6),d7
  84.     addx.b    d7,d7
  85.     bra.s    .cont
  86. bigger:    lea    decrun_table(pc),a4
  87. cont:    moveq    #2,d6
  88.     bsr.s    get_bit2
  89. contus:    move    d5,d4
  90.     move.b    14(a4,d4.w),d6
  91.     ext    d6
  92.     bsr.s    get_bit2
  93.     add    d4,d4
  94.     beq.s    .first
  95.     add    -2(a4,d4.w),d5
  96. .first:    lea    1(a5,d5.w),a4
  97.     move    (a7)+,d5
  98.     move.b    -(a4),-(a5)
  99. .copy_same:    move.b    -(a4),-(a5)
  100.     dbf    d5,.copy_same
  101. make_jnk:    moveq    #11,d6
  102.     moveq    #11,d5
  103. take_jnk:    add.b    d7,d7
  104.     beq.s    empty
  105. cont_jnk:    dbcc    d6,take_jnk
  106.     bcs.s    next_cod
  107.     sub    d6,d5
  108.     bra.s    copy_jnk1
  109. next_cod:    moveq    #7,d6
  110.     bsr.s    get_bit2
  111.     beq.s    .next_cod1
  112.     addq    #8,d5
  113.     addq    #3,d5
  114.     bra.s    copy_jnk1
  115. .next_cod1:    moveq    #2,d6
  116.     bsr.s    get_bit2
  117.     swap    d5
  118.     moveq    #15,d6
  119.     bsr.s    get_bit2
  120.     addq.l    #8,d5
  121.     addq.l    #3,d5    
  122. copy_jnk1:    subq    #1,d5
  123.     bmi.s    .end_word
  124.     moveq    #1,d6
  125.     swap    d6
  126. .copy_jnk:    move.b    -(a6),-(a5)
  127.     dbf    d5,.copy_jnk
  128.     sub.l    d6,d5
  129.     bpl.s    .copy_jnk
  130. .end_word:    cmp.l    a6,a0
  131. .decrunch:    bne    decrunch
  132.     cmp.b    #$80,d7
  133.     bne.s    .decrunch
  134.     ifne    PIC_ALGO
  135.     move.l    (a7)+,a0
  136.     bsr    decod_picture
  137.     endc
  138.     ifne    RESTORE_M
  139.     movem.l    (a7)+,a3-a4
  140.     endc
  141.     move.l    (a7)+,d0
  142.     bsr    copy_decrun
  143.     ifne    RESTORE_M
  144.     moveq    #DEC_MARGE+9,d0
  145. .restore_m:    move.b    -(a3),(a4)+
  146.     dbf    d0,.restore_m
  147.     endc
  148. no_crunched:    movem.l    (a7)+,d0-a6
  149.      rts
  150. empty:    move.b    -(a6),d7
  151.     addx.b    d7,d7
  152.     bra.s    cont_jnk
  153. decrun_table:    dc.w    32,32+64,32+64+256,32+64+256+512,32+64+256+512+1024
  154.     dc.w    32+64+256+512+1024+2048,32+64+256+512+1024+2048+4096
  155.     dc.b    4,5,7,8,9,10,11,12
  156. decrun_table2:    dc.w    32,32+64,32+64+128,32+64+128+256
  157.     dc.w    32+64+128+256+512,32+64+128+256+512*2
  158.     dc.w    32+64+128+256+512*3
  159.     dc.b    4,5,6,7,8,8
  160. tablus_table:    dc.b    $60,$20,$10,$8
  161.     ifne    PIC_ALGO
  162. decod_picture:    move    -(a0),d7
  163.     clr    (a0)
  164. .next_picture:    dbf    d7,.decod_algo
  165.     rts
  166. .decod_algo:    move.l    -(a0),d0
  167.     clr.l    (a0)
  168.     lea    0(a5,d0.l),a1
  169.     lea    $7d00(a1),a2
  170. .next_planes:    moveq    #3,d6
  171. .next_word:    move    (a1)+,d0
  172.     moveq    #3,d5
  173. .next_bits:    add    d0,d0
  174.     addx    d1,d1
  175.     add    d0,d0
  176.     addx    d2,d2
  177.     add    d0,d0
  178.     addx    d3,d3
  179.     add    d0,d0
  180.     addx    d4,d4
  181.     dbf    d5,.next_bits
  182.     dbf    d6,.next_word
  183.     movem    d1-d4,-8(a1)
  184.     cmp.l    a1,a2
  185.     bne.s    .next_planes
  186.     bra.s    .next_picture
  187.     endc
  188. copy_decrun:    lsr.l    #4,d0
  189.     lea    -12(a6),a6
  190. .copy_decrun:    rept    4
  191.     move.l    (a5)+,(a6)+
  192.     endr
  193.     dbf    d0,.copy_decrun
  194.     rts
  195.     ifne    RESTORE_M
  196. buff_marg:    dcb.b    DEC_MARGE+10,0
  197.     endc